package com.huang.controller;

import com.huang.pojo.User;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.huang.jwt.*;

@RestController
@RequestMapping("/jwt")
public class JWT_Controller {

    @RequestMapping("/jwtTest")
    public String test_JWT(User user) throws RuntimeException{

        String token =jwt_token.buildJWT(user.getUsername());
        System.out.println(token);

//        return token;
        String token1 = jwt_token.vaildToken(token);
        return "账号为：" + token1;
    }
}
